package com;

import com.qzw.network.netty.config.NettyServerInit;
import com.qzw.network.netty.config.NettyServerStart;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.net.InetSocketAddress;


/**
 * @author ：quziwei
 * @date ：Created in 2020/6/10 5:21 下午
 * @description：
 */
@SpringBootApplication
@Slf4j
public class NettyServerApp implements CommandLineRunner {
    @Autowired
    private NettyServerStart serverStart;

    @Value("${qzw.netty.server_host}")
    private String host;
    @Value("${qzw.netty.server_port}")
    private Integer port;


    public static void main(String[] args) {
        SpringApplication.run(NettyServerApp.class,args);
    }

    @Override
    public void run(String... args){
        InetSocketAddress address = new InetSocketAddress(host,port);
        serverStart.start(address);
        log.info("Netty 服务器启动成功！！！");
    }
}
